package org.example.zsbback.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.example.zsbback.entity.Book;

import java.util.List;

@Mapper
public interface BookMapper {
    @Select({"<script>",
            " <bind name=\"pattern\" value=\"'%' + _parameter + '%'\" />",
            "  SELECT * FROM t_book",
            "  <where>",
            "    <if test=\"name != null and name != ''\">",
            "        name like   #{pattern}",
            "    </if>",
            "  </where>",
            " </script>"

    })
    List<Book> findAll(String name);
}
